﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace BwTMusic.Controllers
{
    public class HomeController : Controller
    {
        // GET: Home
        public ActionResult Index()
        {
            return View();
        }
        public ActionResult SearchMusic()
        {
            return View();
        }
        public ActionResult MusicListen()
        {
            return View();
        }
        public JsonResult url()
        {
            string path = urlToVirtual(@"D:\CloudMusic\许嵩 - 雅俗共赏.mp3");
            return Json(path, JsonRequestBehavior.AllowGet);
        }
        private string urlToVirtual(string imagesurl1)
        {
            string tmpRootDir = Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath.ToString());//获取程序根目录  
            string imagesurl2 = imagesurl1.Replace(tmpRootDir, ""); //转换成相对路径  
            imagesurl2 = imagesurl2.Replace(@"\", @"/");
            return imagesurl2;
        }
    }
}